#include<iostream>
using namespace std;
int main()
{
    int num = 0;
    cin >> num;
    int n = 0, i = 1, lon = 0;
    int prev = num & 1;
    //0000000111101
    //1+4+8+16+32
    for (int j = 0; j < 32; j++)
    {
        if ((num >> j & 1) == prev && prev == 1)
        {
            n++;
        }
        else
        {
            prev = (num >> j & 1);
            n = 0;
        }
        if (n > lon)
        {
            lon = n;
        }
    }
    cout << lon + 1;
    return 0;
}
